﻿    @{
        Layout = "~/Views/Shared/_Layout.cshtml";
        var X = Html.X();
    }

    @section Head{
    <script type="text/javascript">
        var onAfterRender = function () {
            this.setRawValue(Ext.util.Format.date(this.getRawValue(), "d F Y h:m A"));
        }

        var onSelect = function (combo, record, index) {
            this.setRawValue(Ext.util.Format.date(record[0].data.fecha_hora_inicio, "d F Y h:m A"));
            App.liquidacion_id.setValue(record[0].data.liquidacion_id);
        }

        var onBlur = function () {
            this.setRawValue(Ext.util.Format.date(this.getRawValue(), "d F Y h:m A"));
        }

        var onChangeCliente = function (item,newValue,oldValue)
        {
            if (!item.isValid())
            {
                App.storePagosAbonados.removeAll();
                App.btnNuevo.setDisabled(true);
                App.detallePago.setDisabled(true);
                App.btnEditarTarifa.setDisabled(true);
            }
        }

        var onSelectCliente = function (combo, record, index) {
            if (record[0].data.cliente_id == ""|| record[0].data.cliente_id == null) {
                App.storePagosAbonados.removeAll();
                App.btnNuevo.setDisabled(true);
                App.detallePago.setDisabled(true);
                App.btnEditarTarifa.setDisabled(true);
            } else {
                App.GridPagosAbonados.getSelectionModel().deselectAll(); 
                App.storePagosAbonados.load();
                App.btnNuevo.setDisabled(false);
                App.detallePago.setDisabled(false);
                App.btnEditarTarifa.setDisabled(false);
            }
        }

    </script>
    }

    @(X.Viewport().Layout(LayoutType.Border)
                .Items(
                    X.Panel()
                        .BodyStyle("background-color: transparent;")
                        .Region(Region.Center)
                        .LayoutConfig(new HBoxLayoutConfig() { Align = HBoxAlign.Stretch, Pack = BoxPack.Start })
                        .ItemsFromPage(this, "~/Areas/Parqueos/Views/PagoAbonado/_Grid.cshtml")
                )
    )


